UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I8OTQZQFY6C5X/osd9Gu5xahQo9lHRzLlrSp3XGS2fE=' 
WHERE 
  key_id = '1e17dc7115efce49aa9f20f41fdcebe88325584aea51ef78570a8ccbed1d6978' 
  AND (
    token = 'I8OTQZQFY6C5X/osd9Gu5xahQo9lHRzLlrSp3XGS2fE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059