UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ul1ntM9S7gRdFrHyqrHH58U6cOqVDFOtSQirx8477V4=' 
WHERE 
  key_id = '68f1136d914b5d3d8d14071f4e8145dd6fa200e504368e2095dde1987433e4fe' 
  AND (
    token = 'ul1ntM9S7gRdFrHyqrHH58U6cOqVDFOtSQirx8477V4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038