UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uiAJwCSgMBMkx86OeKAsfk3i8ZA8QAEe41SWb4r6Spo=' 
WHERE 
  key_id = '993758500549ff46a16bcadf01d425f34c091cefc0575ad2ea29c98a6a28abe9' 
  AND (
    token = 'uiAJwCSgMBMkx86OeKAsfk3i8ZA8QAEe41SWb4r6Spo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037