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

Query time 0.00085