UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j6g5pz+d6ucOH5J6lpqp500uxek+XeRXPpKDE15fDL8=' 
WHERE 
  key_id = '578edbc3b0c8b99baaff7cefd37c7302adb135df1cfd77a38fb4c037aa75203a' 
  AND (
    token = 'j6g5pz+d6ucOH5J6lpqp500uxek+XeRXPpKDE15fDL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017