UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yjE+4h8zTsVG1qNUrfQ87Io7CAETLG9dxlYKCOkLWFg=' 
WHERE 
  key_id = '873e845a25c5309d38f7684ca90b0e9cb58304c2a2b2200fcb8ce508a08d1502' 
  AND (
    token = 'yjE+4h8zTsVG1qNUrfQ87Io7CAETLG9dxlYKCOkLWFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034