UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DWgbH/r84T3xvQJ57niD5vtSNMFgMo57xXVrCYIZPDw=' 
WHERE 
  key_id = '45505415eea2bbe05a0fe59bbfc070212baa9e67710e875bcd518e635a56854c' 
  AND (
    token = 'DWgbH/r84T3xvQJ57niD5vtSNMFgMo57xXVrCYIZPDw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031