UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mtRgFh1grepiTyqLa9nUoYBxt83tAyTy9vbT+IEbR6Q=' 
WHERE 
  key_id = 'aa7b035532d620818bff18c14c42d26514e54bc3e9d1f910e95621e38c2d2511' 
  AND (
    token = 'mtRgFh1grepiTyqLa9nUoYBxt83tAyTy9vbT+IEbR6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016