UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0I4mOTCDYLRRWQwRyjWpo9WvqyuQpv7F6M+fQknaleU=' 
WHERE 
  key_id = '6a862522c3b174d518efe3420a1b2a37405e7375580f824e063921ae86259386' 
  AND (
    token = '0I4mOTCDYLRRWQwRyjWpo9WvqyuQpv7F6M+fQknaleU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044