UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FT//dj7YvRk4Ku+KDNGIvtseA1u9neygG5pPZWyA7Yc=' 
WHERE 
  key_id = '9f7d016254e8c9038c465bb283512bff51101a22593470a4764033c33fb24e7d' 
  AND (
    token = 'FT//dj7YvRk4Ku+KDNGIvtseA1u9neygG5pPZWyA7Yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027