UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UVkASlajb5TkzdkyWN431qmpCQKnlfdw+yZy1NChCaE=' 
WHERE 
  key_id = 'fdb50c8eb4a4042827c4e4e4b456452786dd39fa0461a8aceec34920eb03de2e' 
  AND (
    token = 'UVkASlajb5TkzdkyWN431qmpCQKnlfdw+yZy1NChCaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038