UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pedP2XCK3/Njx+70CDB40C8ud9h3I/cZsVtMX6sERaQ=' 
WHERE 
  key_id = '9352e6fdfab6f3df604d999900a6cae3039da52dc4c2bfdf3450eb4d3acd04f6' 
  AND (
    token = 'pedP2XCK3/Njx+70CDB40C8ud9h3I/cZsVtMX6sERaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021