UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yGM2sAJWei3cjRpxz51SXFpgpywb2sAMecLEwu+QDRo=' 
WHERE 
  key_id = '2dfdf53d27355c100016c90f17df6729bcc5f3feaf50c94e4101b71874ae3fc1' 
  AND (
    token = 'yGM2sAJWei3cjRpxz51SXFpgpywb2sAMecLEwu+QDRo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030