UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RBREcHOG08mL0a9J5pr02qzrlF84l3xL9txvIGDUuyA=' 
WHERE 
  key_id = '7f3a6d667dde638c0f1e0638468107c78460fb90b1d1532e702ca4adae7be2da' 
  AND (
    token = 'RBREcHOG08mL0a9J5pr02qzrlF84l3xL9txvIGDUuyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034