UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r0tum17F4AlC8PsOAmO47p3Rr4r7L7FdqLMLOVsNsUs=' 
WHERE 
  key_id = 'e505b3c3908fd965262f5f02d2e3c0460cf09182f5d96a738eddb28c42732679' 
  AND (
    token = 'r0tum17F4AlC8PsOAmO47p3Rr4r7L7FdqLMLOVsNsUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033