UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2uSQOXd5v5BJHrFOPtfwnaZ6DuoMhHrAF08l2Rwx3ng=' 
WHERE 
  key_id = 'b3017f7193943f00f0c80f5161a83a78e8cf0964269670e1e0612203dac7a7b2' 
  AND (
    token = '2uSQOXd5v5BJHrFOPtfwnaZ6DuoMhHrAF08l2Rwx3ng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043