UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ayfb3KhrTLWHU6ZT9avVf3S98Lpxi4b5afsuOPxuTkk=' 
WHERE 
  key_id = 'ab64b6fbf79b98c74a19b959ab01bb227f0518f3c8acd8f8c728f1073413d24b' 
  AND (
    token = 'ayfb3KhrTLWHU6ZT9avVf3S98Lpxi4b5afsuOPxuTkk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046