UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z4Q0ByIR6Ie8xIA3Ym4khCY6G4WGQO1V59WXmXgr830=' 
WHERE 
  key_id = '46843258a8e7a3aeb6d1082c524f12ea21ba342df17ee1471aa2a86f344ace1f' 
  AND (
    token = 'z4Q0ByIR6Ie8xIA3Ym4khCY6G4WGQO1V59WXmXgr830=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029