UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KcSKdMivKEuxcZpkM8l9m2F4dZP+rcNMb6ImF6Y+4I8=' 
WHERE 
  key_id = '93e2a188495c1d406b9d0197b92ecc848305540afd078571dec14936fcb4dcb1' 
  AND (
    token = 'KcSKdMivKEuxcZpkM8l9m2F4dZP+rcNMb6ImF6Y+4I8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032