UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wy/3ssZHXRFGLfiaAInT3XE/lTEzNVfItV51rrXX09Y=' 
WHERE 
  key_id = '6dbe7fec533975e143dc6e6c0b7343f37b1fc182951a424c3245adc20a1fa359' 
  AND (
    token = 'Wy/3ssZHXRFGLfiaAInT3XE/lTEzNVfItV51rrXX09Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056