UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GrZdvUD6cXB2FZRv272tTPu3RR/NOU+McftU0+16KjY=' 
WHERE 
  key_id = '28578a1d0f694c36e3ab361153d257e3ee9289024897d74bd87c7fb132e1c88f' 
  AND (
    token = 'GrZdvUD6cXB2FZRv272tTPu3RR/NOU+McftU0+16KjY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060