UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R4qL4fWXOPzC2afKJT3s7SS4J2Y8Vcr6685AnXXvcEQ=' 
WHERE 
  key_id = '85f36ff61c9b849f5b50853fc9f615a0171516b8af9535a18253ee0ee8a55c28' 
  AND (
    token = 'R4qL4fWXOPzC2afKJT3s7SS4J2Y8Vcr6685AnXXvcEQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040