UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WuHo8v8dxlNX7MypJk/p+w5zJFo4Qf661oO1s67zPik=' 
WHERE 
  key_id = 'b0d5d80f21af601b92d9127d83be556dda55e238504aabe5590ae1bdf040d802' 
  AND (
    token = 'WuHo8v8dxlNX7MypJk/p+w5zJFo4Qf661oO1s67zPik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032