UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TiDCdSckGz7KHDU7piJwVfOatXS0qak+T+2n5hdTcrE=' 
WHERE 
  key_id = 'fa1eb437836e72e4b3519c15fdca0d9cfcb1c37d1990e8583d5d274af5a264a1' 
  AND (
    token = 'TiDCdSckGz7KHDU7piJwVfOatXS0qak+T+2n5hdTcrE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036